import {INCREMENT,DECREMENT} from "../constents/countConst"

const init ={
    count:0
}


export const countReducer =(prevState=init,action)=>{
    const{
        type,
        data
    }=action
    switch(type){
        case INCREMENT:
            return{...init,count:prevState.count+data}
    }
    switch(type){
        case DECREMENT:
            return{...init,count:prevState.count-data}
    }
    
return prevState
}